#!/usr/bin/env python
#
#   Copyright (C) 2006 by Patrick Stinson and Jonathan Saggau             
#   patrickkidd@gmail.com   saggau@gmail.com                              
#                                                                         
#   This program is free software; you can redistribute it and/or modify  
#   it under the terms of the GNU General Public License as published by  
#   the Free Software Foundation; either version 2 of the License, or     
#   (at your option) any later version.                                   
#                                                                         
#   This program is distributed in the hope that it will be useful,       
#   but WITHOUT ANY WARRANTY; without even the implied warranty of        
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         
#   GNU General Public License for more details.                          
#                                                                         
#   You should have received a copy of the GNU General Public License     
#   along with this program; if not, write to the                         
#   Free Software Foundation, Inc.,                                       
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  
#
import unittest
from supyrconductor import msg

class MsgTest(unittest.TestCase):

    def setUp(self):
        pass
        
    def test_functions(self):
        self.assertEqual(msg._flattenMsg(['/hello', [1,2,3]]), 
                                         ['/hello', 1,2,3])
        self.assertEqual(msg._flattenMsg(('/hello', (1,2,3))), 
                                         ['/hello', 1,2,3])
        self.assertEqual(msg._flattenMsg(('/hello', [1,2,3])), 
                                         ['/hello', 1,2,3])
                                            
        self.assertEqual(msg.msg('/_msg', [1,2,3]), 
                                ['/_msg', 1,2,3])
        self.assertEqual(msg.dictmsg('/_msg', {'key':'value', 1:2}),
                                     ['/_msg', 1, 2, 'key', 'value'])
        # TODO: add setnmsg
                                     
    if __name__ == '__main__':
        unittest.main()